package com.tencent.wxcloudrun.controller;

import com.tencent.wxcloudrun.config.ApiResponse;
import com.tencent.wxcloudrun.dto.CounterRequest;
import com.tencent.wxcloudrun.model.Counter;
import com.tencent.wxcloudrun.model.KTask;
import com.tencent.wxcloudrun.service.CounterService;
import com.tencent.wxcloudrun.service.TaskService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Optional;

/**
 * index控制器
 */
@RestController
@Slf4j
public class TaskController {

  @Resource
  private TaskService taskService;



  @PostMapping(value = "/api/task/add")
  ApiResponse create(@RequestBody KTask task) {
    log.info("/api/task/add post request, action: {}", task);
    int insert = taskService.insert(task);
    return ApiResponse.ok(insert);
  }

}
